package com.czh.www;

import javax.swing.*;
import java.awt.*;

public class test extends JFrame {
    private JPanel pan = new JPanel();
    JScrollPane scroll;
    private JButton btn;
    Container pane;

    public test() {
        this.scroll = new JScrollPane(this.pan);
        this.btn = new JButton("test");
        this.pane = this.getContentPane();
        this.pane.setLayout(new BoxLayout(this.pane, 1));
        this.pan.setPreferredSize(new Dimension(1000, 700));
        this.pan.setBackground(Color.yellow);
        this.scroll.setViewportView(this.pan);
        this.scroll.setHorizontalScrollBarPolicy(32);
        this.scroll.setVerticalScrollBarPolicy(22);
        this.scroll.setSize(300, 200);
        this.pan.setLayout(null);
        this.pan.add(this.btn);
        this.btn.setLocation(20, 100);
        this.btn.setSize(40, 20);
        this.pane.add(this.scroll);
        this.setSize(800, 600);
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new test();
    }
}
